<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/WEB-INF/templates/template.xhtml">
<ui:define name="conteudo">
<h:body styleClass="corpo">
<h:outputStylesheet name="Urna.css" library="css"/>
<br/>
	<p:panelGrid columns="2" styleClass="grid2">
		<p:outputLabel value="Bem vindo eleitor: #{logadoBean.logado()}"/><a href="/Urna/eleitor/j_spring_security_logout">logout</a>
	</p:panelGrid>
<br/>
<br/>

	<p:panel header="Urna Eletrônica" styleClass="urna">

		Escolha seu candidato na lista abaixo e clique em Descrição
		<br/>
		<br/>
		<h:form>
	   		<p:selectOneMenu hideNoSelectionOption="false" value="#{candidatoBean.idCandidatoSelecionado}">
	   			
	   			<f:selectItems
	   				value="#{candidatoBean.lista}"
	   				var="candidato"
	   				noSelectionValue="true"
	   				itemValue="#{candidato.c_id}"
	   				itemLabel="#{candidato.nome}">
	   			</f:selectItems>
	   		</p:selectOneMenu>
	   		<h:commandButton value="Descrição" action="#{candidatoBean.carregaCandidato()}"></h:commandButton>
	   		
	   </h:form>
	   
	   <ui:include src="/WEB-INF/includes/candidato-info.xhtml">
	   		<ui:param name="candidato" value="#{candidatoBean.candidatoSelecionado}"></ui:param>
	   </ui:include>
	   <br/>		
	   <br/>
	   <p:commandButton value="Votar" actionListener="#{candidatoBean.atualiza}" onclick="msg.show();" styleClass="vota"/>	

	</p:panel>
	
	<p:dialog id="mensagem" header="OBRIGADO POR VOTAR!" widgetVar="msg" modal="true" closable="false">
		<a href="/Urna/eleitor/j_spring_security_logout">
			<h:commandButton value="OK" oncomplete="msg.hide();"/>
		</a>	
	</p:dialog>
<br/>
<br/>
<br/>
</h:body>
</ui:define>
</ui:composition>
</html>